-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Improve urlencoding logic + bug fixes #4338
Conversation
@@ -227,7 +227,7 @@ def __init__(self, *args: Any, **kwargs: Any): | |||
if bound_args.arguments.get("endpoint") is None: | |||
_, endpoint = _normalized_endpoint(None) | |||
bound_args.arguments["endpoint"] = endpoint | |||
super().__init__(*args, **kwargs) | |||
super().__init__(**bound_args.arguments) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I know the difference. lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didnt pipe in the headers if a user set them for our GRPCExporter :(
name, value = parts | ||
encoded_header = f"{urllib.parse.quote(name)}={urllib.parse.quote(value)}" | ||
match = _HEADER_PATTERN.fullmatch(encoded_header.strip()) | ||
if not match: | ||
_logger.warning( | ||
"Header format invalid! Header values in environment variables must be " | ||
"URL encoded: %s", | ||
header, | ||
f"{name}: ****", | ||
) | ||
continue | ||
_logger.warning( | ||
f"Header values in environment variables should be URL encoded, ``{header}`` " | ||
f"was urlencoded to: ``{encoded_header}``" | ||
"Header values in environment variables should be URL encoded, attempting to " | ||
"URL encode header: {name}: ****" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I know what's being fixed here. Can you update the description?
PHOENIX_CLIENT_HEADERS
environment variable is not URL encoded, we will attempt to URL encode the header along while also printing a warning message. This PR mangles the header values, in case sensitive information such as authorization tokens are included in them.